#include "comm/znx_cleanup.h"

void znx_dump(void *arg)
{
    printf("%d\n", (int)(intptr_t)arg);
}

int main()
{
    znx_cleanup_list_t   g_cleanup_list;
    znx_cleanup_list_init(&g_cleanup_list);

    znx_cleanup_item_t *item1 =
        znx_cleanup_list_add(&g_cleanup_list,
            znx_dump, (void *)(intptr_t)1);

    znx_cleanup_item_t *item2 =
        znx_cleanup_list_add(&g_cleanup_list,
            znx_dump, (void *)(intptr_t)2);

    znx_cleanup_item_t *item3 =
        znx_cleanup_list_add(&g_cleanup_list,
            znx_dump, (void *)(intptr_t)3);

    znx_cleanup_item_t *item4 =
        znx_cleanup_list_add(&g_cleanup_list,
            znx_dump, (void *)(intptr_t)4);

    znx_cleanup_item_t *item5 =
        znx_cleanup_list_add(&g_cleanup_list,
            znx_dump, (void *)(intptr_t)5);

    znx_cleanup_item_t *item6 =
        znx_cleanup_list_add(&g_cleanup_list,
            znx_dump, (void *)(intptr_t)6);

    (void)item1;
    (void)item2;
    (void)item3;
    (void)item4;
    (void)item5;
    (void)item6;

    znx_cleanup_list_del(&g_cleanup_list, item3);

    znx_cleanup_list_exec(&g_cleanup_list);
}
